<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./js/lodash.min.js"></script>
    <script>
        let student = {
            name:'rose',
            age:18,
            boyfriend:{
                name:'jack',
                age:20
            },
            school:undefined,
            study(){
                console.log('正在学习');
            }
        }
        // 缺点：无法拷贝undefined和函数
        // let stuCopy = JSON.parse(JSON.stringify(student))
        // console.log(stuCopy);

        // _ === lodash
        const stuCopy = _.cloneDeep(student)
        console.log(stuCopy);
        console.log(stuCopy === student);
        console.log(stuCopy.boyfriend === student.boyfriend);
    </script>
</body>
</html>